<extend name="template/base_index" />


<block name="area_header">

    <link rel="stylesheet" type="text/css" media="all" href="__CDN__/jquery-datetimepicker/jquery.datetimepicker.css">
    <script type="text/javascript" src="__CDN__/jquery-datetimepicker/jquery.datetimepicker.js"></script>
    <script type="text/javascript" src="__CDN__/jquery-validation/1.13.1/jquery.validate.min.js"></script>
    <script type="text/javascript" src="__CDN__/jquery-validation/1.13.1/localization/messages_zh.min.js"></script>

    <script type="text/javascript" charset="utf-8" src="__UPLOAD__/ueditor/1.4.3/ueditor.config.js"></script>
    <script type="text/javascript" charset="utf-8" src="__UPLOAD__/ueditor/1.4.3/ueditor.all.min.js"> </script>
    <link type="text/css" rel="stylesheet" href="__CDN__/comp/wxuploader.css?v=__APP_VERSION__" />
    <link type="text/css" rel="stylesheet" href="__CDN__/jquery-uploadify/3.2.1/uploadify.css" />
    <script type="text/javascript" src="__CDN__/jquery-uploadify/3.2.1/jquery.uploadify.min.js"></script>
</block>

<block name="area_body">
    {:W('Menus/topbar')}
    <div class="admin-main container-fluid">
        {:W('Menus/left')}
        <div class="admin-main-content">
            {:W('Menus/breadcrumb')}
            <style type="text/css">
                .tip-title {
                    color:red;
                }
                .screen-box {
                    position: fixed;
                    bottom: 0;
                    left: 0;
                    right: 0;
                    height: 0;
                    width: 100%;
                    height: 100%;
                    z-index: 10;
                    background-color:rgba(0, 0, 0, 0.6);
                    opacity:1;
                    display:none;
                    transition: opacity .3s;
                }
                .screen-contain {
                    margin:300px auto;
                    width:50px;
                    height:50px;
                    z-index:100;
                    font-size:50px;
                    color:white;
                }
                #imgbox-overlay{
                    position: absolute;
                    top: 0;
                    left: 0;
                    width: 100%;
                    height: 100%;
                    background: #000;
                    display: none;
                    z-index: 80;
                    opacity: 0.5;
                }
                .imgbox-img{
                    position: absolute;
                    top: 201px;
                    left: 550px;
                    z-index: 89;
                    background:white;
                    display: none;
                }
                .imgbox-img img {
                    margin:10px;
                }
            </style>
            <center>
                <div class="tip-title"><h4>请您一定要确认再批量添加简历之前已经将相应的学生注册过了 否则简历添加是不会成功的(<a onclick="popup()">查看格式</a>)</h4></div>
                <input id="file_upload" name="file_upload" type="file" multiple="true">
                <span id="filename"></span><br/>
                <div class="tip-box"></div>
                <a  data-value="" id='leadname' onclick="ajax_leaddata()" class="confirm btn btn-primary" >将文件导入数据库</a>
            </center>
        </div>
        <!-- END admin-main-content -->
    </div>
    <!--隐藏一个加载幕布-->
    <div class="screen-box">
        <div class="screen-contain"><div><i class="fa fa-spinner fa-spin"></i></div></div>
    </div>
    <!--隐藏一个查看图片的幕布-->
    <div id="imgbox-overlay" onclick="popup()">
    </div>
    <div class="imgbox-img"><img src="__IMG__/student_resume.png"/></div>

    <!-- END admin-main-->
    <!--文件上传js-->
    <script type="text/javascript">
        $(function() {
            $('#file_upload').uploadify({
                'swf'      : '__CDN__/jquery-uploadify/3.2.1/uploadify.swf',    //指定上传控件的主体文件
                'uploader' : "{:U('School/upload',array('type'=>'resume'))}",  //指定服务器端上传处理文件
                //其他配置项
                'buttonText' :'文件上传',
                'fileExt': '*.xls;*.xlsx;*.xlsm',
                'onUploadSuccess':function(file,data,response){
                    if(!response){
                        $('#filename').html('上传失败');
                    }else{
                        $('#filename').html(file.name);
                        $('#leadname').attr('data-value',file.name);
                    }

                },
                onError: function(errorObj) {
                    alert(errorObj.info+"  "+errorObj.type);
                }
            });
        });

        /*异步ajax导入数据*/
        function ajax_leaddata(){
            $('.screen-box').css('display','block');
            var filename = $('#leadname').attr('data-value');
            $.get("{:U('School/lead_resume')}",{'name':filename},function(data){
                $('.screen-box').css('display','none');
                $('.tip-box').html(data);
            });
        }

        /*查看规范图片*/
        function popup(){
            $('#imgbox-overlay').toggle(200);
            $('.imgbox-img').toggle(200);
        }
    </script>
</block>

<block name="area_footer">

</block>